/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Aug 28, 2013  11:27:29 AM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : com.tis.database.dao.impl
 * File Name : AdActiveDirectoryDaoImpl.java
 * TODO
 */
package com.tis.database.dao.security.impl;

import java.math.BigDecimal;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.tis.database.dao.impl.AbstractDaoImpl;
import com.tis.database.dao.security.AdActiveDirectoryDao;
import com.tis.database.entitys.security.AdActiveDirectory;

/**
 * @author Administrator
 *
 */
@Repository
@SuppressWarnings("unchecked")
public class AdActiveDirectoryDaoImpl extends AbstractDaoImpl<AdActiveDirectory, BigDecimal> implements AdActiveDirectoryDao {
	
	private static final Logger log = LoggerFactory.getLogger(AdActiveDirectoryDaoImpl.class);

	/**
	 * @param entityClass
	 */
	public AdActiveDirectoryDaoImpl() {
		super(AdActiveDirectory.class);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByCode(java.lang.String)
	 */
	@Override
	public List<AdActiveDirectory> findByCode(String code) throws HibernateException{
		
		return findByCriteria(Restrictions.like("code", code, MatchMode.ANYWHERE));
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByAdName(java.lang.String)
	 */
	@Override
	public List<AdActiveDirectory> findByAdName(String adName) throws HibernateException{
		
		return findByCriteria(Restrictions.like("adName", adName, MatchMode.ANYWHERE));
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByName(java.lang.String)
	 */
	@Override	
	public List<AdActiveDirectory> findByName(String name) throws HibernateException{
		
		return findByCriteria(Restrictions.like("name", name, MatchMode.ANYWHERE));
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByDescription(java.lang.String)
	 */
	@Override	
	public List<AdActiveDirectory> findByDescription(String description) throws HibernateException{
		
		return findByCriteria(Restrictions.like("description", description, MatchMode.ANYWHERE));
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByIsActive(java.lang.String)
	 */
	@Override	
	public List<AdActiveDirectory> findByIsActive(String isactive) throws HibernateException{
		
		return findByCriteria(Restrictions.like("isactive", isactive, MatchMode.ANYWHERE));
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByIsDelete(java.lang.String)
	 */
	@Override	
	public List<AdActiveDirectory> findByIsDelete(String isdeleted) throws HibernateException{
		
		return findByCriteria(Restrictions.like("isdeleted", isdeleted, MatchMode.ANYWHERE));
	}

	/* (non-Javadoc)
	 * @see com.tis.database.dao.AdActiveDirectoryDao#findByStatus(java.lang.String)
	 */
	@Override	
	public List<AdActiveDirectory> findByStatus(String status) throws HibernateException{
		
		return findByCriteria(Restrictions.like("status", status, MatchMode.ANYWHERE));
	}

}
